<template>
  <contentModel title="供应商合同信息" :has-footer="false" @close="handleClose">
    <query-page
      :table-component-config="tableComponentConfig"
      :table-render-config="mainform5"
      :table-render-keys="mainform5Keys"
      :loading="isLoading2"
      :data="renderData2"
      :total="totalNum2"
      :has-line="false"
      height="calc(100vh - 240px)"
      @query-data="getContractNoData"
    >
    </query-page>
  </contentModel>
</template>

<script lang="ts" setup>
  import { ref, defineProps } from 'vue';
  import contentModel from '@/common/components/content-model/index.vue';
  import queryPage from '@/common/components/query-page/index.vue';
  import { getContractNo } from '@/api/supplier/quotation-information';
  import {
    mainform5,
    mainform5Keys,
    tableComponentConfig,
  } from '@/views/basic-configuration/definitionsuppliers/suppliercolumns';

  const props = defineProps({
    detalisId: {
      type: Object,
      default: () => {
        return {};
      },
      required: false,
    },
  });
  const totalNum2 = ref(0);
  const renderData2 = ref([]);
  const isLoading2 = ref(false);
  // 子表
  const getContractNoData = async (queryInfo?: any) => {
    console.log(queryInfo, 'queryInfo======', props.detalisId);

    renderData2.value = [];
    const params = {
      supplierName: props.detalisId.supplierCode,
      mdsItemCode: props.detalisId.materialCode,
      ...queryInfo,
    };
    const { data } = await getContractNo(params);
    renderData2.value = data;
    totalNum2.value = data.length;
  };
  const emit = defineEmits(['close']);
  const handleClose = () => {
    emit('close');
  };
</script>
